<template>
    <div>
        <div class="login_input">
            <el-input v-model="username" placeholder="请输入用户名"></el-input>
            <el-input type="password" v-model="password" placeholder="请输入密码"></el-input>
            <el-button type="primary" size="medium" @click="logins">登录</el-button>
        </div>
    </div>
</template>

<script>
import http from '@/api/axiosFZ.js'
import cookies from 'vue-cookies'
// import axios from 'axios'
export default {
    data(){
        return {
            username:'',
            password:''
        }
    },
    created(){
        
    },
    methods:{
        logins(){
            let data = {
                userName:this.username,
                password:this.password ,
            }
            let _this = this
            // http.post('/api/user/login',data).then(res=>{
            //     console.log(res)
            //     if(res.data.code == 200 && res.data.message){
            //         cookies.set('username',this.username)
            //         _this.$router.push('/index')
            //     }
            // }).catch(error=>{
            //     console.log(error)
            // })
            console.log("点击了")
            cookies.set('username',this.username)
            localStorage.username = this.username
            _this.$router.push('/index')
        }
    }
}
</script>

<style scoped>
.login_input{
    width: 500px;
    height:400px;
    margin:0px auto;
}
</style>

